package cn.bigway.app.weavingdesigner.util;

import java.awt.image.BufferedImage;

import javax.swing.JPanel;
import javax.swing.JScrollPane;

public class WdImageViewPanel extends JScrollPane {

	private static final long serialVersionUID = -3145653687764406329L;

	private JPanel borderPanel;
	private WdImagePanel imagePanel;

	protected WdImageViewPanel(JPanel borderPanel, BufferedImage image) {
		super(borderPanel);
		this.borderPanel = borderPanel;
		this.imagePanel = new WdImagePanel(this, image);
		borderPanel.add(this.imagePanel);
		setAutoscrolls(true);
	}

	protected WdImagePanel getImagePanel() {
		return this.imagePanel;
	}

	protected void adjustLayout() {
		this.imagePanel.doLayout();
		this.borderPanel.doLayout();
		doLayout();
	}
}
